#-----convert the sas file to csv ----
require(sas7bdat)
fname = Sys.glob('*.sas7bdat')

for(f in fname){
      print(f)
      b = read.sas7bdat(f)
      fnameNew = paste(f,'.csv',sep='')
      write.table(b,fnameNew,sep=',',row.names=F)
      b = 0
}